#include <head.h>

int main(int argc, char const *argv[])
{
    if (3 != argc)
    {
        printf("格式错误 : %s file_dest file_src\n", argv[0]);
        return 0;
    }
    int fd_dest = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0666);
    OPEN_ERR(fd_dest);
    int fd_src = open(argv[2], O_RDONLY);
    OPEN_ERR(fd_src);
    char buf[1024];
    int Byte;
    while((0 < (Byte = read(fd_src, buf, sizeof(buf)))))
    {
        write(fd_dest, buf, Byte);
    }
    close(fd_dest);
    close(fd_src);
    return 0;
}
